Remove some useless String::to_string calls
authormcarton <cartonmartin+git@gmail.com>
Fri, 15 Jan 2016 16:35:22 +0000 (17:35 +0100)
committermcarton <cartonmartin+git@gmail.com>
Sat, 16 Jan 2016 12:02:26 +0000 (13:02 +0100)
Fix some Clippy’s string_to_string warnings.

src/cargo/ops/cargo_doc.rs
src/cargo/ops/cargo_new.rs
src/cargo/ops/cargo_rustc/context.rs
src/cargo/ops/registry.rs

index a6c38c295d47d99ee0709e31430e124478ccf430..ff4e1ec2694265993419032d187e2d677cbb1773 100644 (file)
@@ -42,7 +42,7 @@ pub fn doc(manifest_path: &Path,
             bail!("Passing multiple packages and `open` is not supported")
         } else if options.compile_opts.spec.len() == 1 {
             try!(PackageIdSpec::parse(&options.compile_opts.spec[0]))
-                                             .name().replace("-", "_").to_string()
+                                             .name().replace("-", "_")
         } else {
             match lib_names.iter().chain(bin_names.iter()).nth(0) {
                 Some(s) => s.to_string(),
index cf54e87d90733ef6b3d9f9fe2248573f4ad180ce..18cfeb88ff2c615bd311e3b5a45de549466e103d 100644 (file)
@@ -175,7 +175,6 @@ fn discover_author() -> CargoResult<(String, Option<String>)> {
     let git_config = GitConfig::open_default().ok();
     let git_config = git_config.as_ref();
     let name = git_config.and_then(|g| g.get_string("user.name").ok())
-                         .map(|s| s.to_string())
                          .or_else(|| env::var("USER").ok())      // unix
                          .or_else(|| env::var("USERNAME").ok()); // windows
     let name = match name {
index 34f249b53afccbaf5089af0691bb5068cfac5f8d..73bb2ec41ff55de4279bc05755be34700f944e51 100644 (file)
@@ -134,7 +134,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
             lines.next().unwrap().trim()
                  .split('_').skip(1).next().unwrap().to_string()
         };
-        Ok((dylib, exe_suffix.to_string()))
+        Ok((dylib, exe_suffix))
     }
 
     /// Prepare this context, ensuring that all filesystem directories are in
@@ -244,7 +244,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
             None if unit.target.allows_underscores() => {
                 unit.target.name().to_string()
             }
-            None => unit.target.crate_name().to_string(),
+            None => unit.target.crate_name(),
         }
     }
 
index 4865d8d89cf0c2e1de301c52837c916edcfeb39b..3ae68e7095fe5b3d09168b3783c3cf5af6e23fd8 100644 (file)
@@ -366,7 +366,7 @@ pub fn search(query: &str, config: &Config, index: Option<String>) -> CargoResul
             Some(desc) => {
                 let space = repeat(' ').take(description_margin - name.len())
                                        .collect::<String>();
-                name.to_string() + &space + &desc
+                name + &space + &desc
             }
             None => name
         };